package com.xmy.cultivate.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xmy.cultivate.entity.EnrollSchoolMember;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface EnrollSchoolMemberMapper extends BaseMapper<EnrollSchoolMember> {

    @Select("select GROUP_CONCAT(t2.school_name) from enroll_school_member as t1 INNER JOIN enroll_school as t2 on t1.enroll_school_id = t2.id where t1.id <> ${id} and t1.teacher_id = ${teacherId} and #{endDate} BETWEEN t1.start_date and t1.end_date and t1.deleted = 0 GROUP BY t1.enroll_school_id")
    public abstract String getAtCount(@Param("id") Long id, @Param("teacherId") Long teacherId, @Param("endDate")LocalDate endDate);
}
